﻿using System;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.Collections.Generic;
using System.IO;

namespace _1.ListAllDirectories.Web
{
    [ServiceContract(Namespace = "")]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public class ServiceGetDirs
    {
        [OperationContract]
        public string[] ListDirs(string path)
        {
            try
            {
                return Directory.GetDirectories(path);
            }
            catch (Exception)
            {
                return null;
            }
        }

        [OperationContract]
        public string[] ListFiles(string path)
        {
            return Directory.GetFiles(path);
        }        
        // Add more operations here and mark them with [OperationContract]
    }
}
